package com.niit.musicserve.service.impl;

import com.niit.musicserve.dao.ConsumerMapper;
import com.niit.musicserve.entity.Consumer;
import com.niit.musicserve.service.ConsumerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConsumerServiceImpl implements ConsumerService {
	
	@Autowired
	private ConsumerMapper consumerMapper;
	
	@Override
	public Integer regConsumer(Consumer consumer) {return consumerMapper.addConsumer(consumer);
	}
	
	@Override
	public List<Consumer> allConsumer() {
		return consumerMapper.allConsumer();
	}
	
	@Override
	public Consumer consumerOfId(int consumerId) {
		return consumerMapper.consumerOfId(consumerId);
	}
	
	@Override
	public List<Consumer> consumerOfName(String consumerName) {
		return consumerMapper.consumerOfName(consumerName);
	}
	
	@Override
	public List<Consumer> consumerOfLikeName(String consumerName) {return consumerMapper.likeConsumerOfName(consumerName);}
	
	@Override
	public Boolean deleteConsumer(int consumerId) {return consumerMapper.deleteConsumer(consumerId) > 0;}
	
	@Override
	public Boolean updateConsumer(Consumer consumer) {return consumerMapper.updateConsumer(consumer) > 0;
	}
	
	@Override
	public Consumer consumerOfEmail(String consumerEmail) {return consumerMapper.consumerOfEmail(consumerEmail);
	}
	
	@Override
	public Integer numberOfConsumer() {return consumerMapper.numberOfConsumer();}
	
	@Override
	public Integer updatePassword(String password, int consumerId) {return consumerMapper.updatePassword(password, consumerId);}
}
